<script type="text/javascript">
 $(function(){
	 $.post("getActiveUser",function(json){
		 $("input[name='userId']").val(json.userId);
		 $("input[name='userNo']").val(json.userNo);
		 $("input[name='userName']").val(json.userName);
		 $("input[name='loginName']").val(json.loginName);
		/*  $("input[name='oldPassword']").val(json.loginPassword); */
		},"json");
	
}); 
 
 function checkOldPassword(c){
	 var userNo = $("input[name='userNo']").val();
	 var oldPassword=$("input[name='oldPassword']").val();
	 $.post("checkOldPassword",{"userNo":userNo,"oldPassword":oldPassword},function(data){
		 if(!data){
			 alertMsg.error("原密码输入错误，请重新输入")
			 return false;
		 }else if(c){
			 c()
		 }
	 })
	 
 }
 
function checkPassword(){
	
	
	checkOldPassword(function r(){
		var pwd1=$("input[name='loginPassword']").val();
		var pwd2=$("input[name='passWord']").val();
		
		if(pwd1!=pwd2){
			 alertMsg.warn("重复密码与新密码不一致，请重新输入");
			 return false;
		}else{
			commitForm();
		}
		

	})
	
function commitForm(){
		var form = $("form")
		$.post('updatepassWord',form.serialize(),function(){
			$.pdialog.closeCurrent();
		})
	}
	
	
}
</script>
<div class="pageContent">
	<form method="post"  class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone);">
		<div class="pageFormContent" layoutH="58" hight="163px">
			<div id=userNo>
			<p>
				<label>员工编号：</label>
				<input name="userNo"  type="text" size="15"  readonly="readonly"/>
				<input name="userId"  type="hidden"  readonly="readonly"/>
			</p>
			</div>
			<p>
				<label>员工名称：</label>
				<input  name="userName"  type="text" size="15"   readonly="readonly"/>
			</p>
			<p>
				<label>登陆名：</label>
				<input  name="loginName"  type="text" size="15"   readonly="readonly"/>
			</p>
 			<p>
				<label>原密码：</label>
				<input  name="oldPassword"  type="password" class="required" size="15" minlength='6'  maxlength='10' onblur='checkOldPassword()'/>
			</p> 
			<p>
				<label>新密码：</label>
				<input  name="loginPassword"  type="password" size="15" class="required" minlength='6'  maxlength='10'/>
			</p>
			<p>
				<label>重复密码：</label>
				<input  name="passWord"  type="password" size="15" class="required" minlength='6'  maxlength='10'/>
			</p>
		
		</div>
		<div class="formBar">
			<ul> 
				<li>
				<div class="buttonActive"><div class="buttonContent">
				<button id="submit" type="button" onclick="return checkPassword();">提交</button></div></div>
				</li>
			</ul>
		</div>
	</form>
</div>